import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/views/layout/Layout'

export const constantRouterMap = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path*',
        component: () => import('@/views/redirect/index')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/auth-redirect',
    component: () => import('@/views/login/authredirect'),
    hidden: true
  },
  {
    path: '/error/404',
    component: Layout,
    hidden: true,
    redirect: '/404',
    children: [
      {
        path: '/404',
        component: () => import('@/views/errorPage/404')
      }
    ]
  },
  {
    path: '/error/401',
    component: Layout,
    hidden: true,
    redirect: '/401',
    children: [
      {
        path: '/401',
        component: () => import('@/views/errorPage/401')
      }
    ]
  },
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: '/home',
        component: () => import('@/views/dashboard/index'),
        name: 'Dashboard',
        meta: { title: '首页', icon: 'el-icon-s-home', noCache: true }
      }
    ]
  },
  /*  {
        path: '/studentInfo',
        component: Layout,
        name:'StudentInfo',
        meta:{title:'信息管理', icon:'el-icon-s-promotion'},
        redirect: '/studentImport',
        children: [
            {
                path: '/studentImport',
                component: () => import('@/views/student/import'),
                name: 'StudentImport',
                meta: { title: '文件上传', noCache: true }
            },
            {
                path: '/studentList',
                component: () => import('@/views/student/list'),
                name: 'StudentList',
                meta: { title: '信息列表', noCache: true }
            },
            {
                path: '/studentExport',
                component: () => import('@/views/student/export'),
                name: 'StudentExport',
                meta: { title: '搜索下载', noCache: true }
            },
            {
                path: '/studentLog',
                component: () => import('@/views/student/logs'),
                name: 'StudentLog',
                meta: { title: '操作日志', noCache: true }
            }

        ]
    },
  {
      path: '/baseInfo',
      component: Layout,
      meta:{title:'基础管理', icon:'el-icon-menu'},
      name: 'BaseInfo',
      redirect: '/adminMenuList',
      children: [
          {
              path: '/adminMenuList',
              component: () => import('@/views/adminMenu/list'),
              name: 'AdminMenuList',
              meta: { title: '菜单管理', noCache: true }
          },
          {
              path: '/adminUserList',
              component: () => import('@/views/adminUser/list'),
              name: 'AdminUserList',
              meta: { title: '用户管理', noCache: true }
          },
          {
              path: '/adminUserDetail',
              component: () => import('@/views/adminUser/detail'),
              name: 'AdminUserDetail',
              meta: { title: '用户管理' },
              hidden: true
          },
          {
              path: '/adminRoleList',
              component: () => import('@/views/adminRole/list'),
              name: 'AdminRoleList',
              meta: { title: '角色管理', noCache: true }
          },
          {
              path: '/roleList/:id',
              component: () => import('@/views/adminRole/detail'),
              name: 'AdminRoleDetail',
              meta: { title: '角色管理' },
              hidden: true
          }
      ]
  },*/
]

export const adminRouterMap = [
    {
        path: '/studentInfo',
        component: Layout,
        name:'StudentInfo',
        meta:{title:'信息管理', icon:'el-icon-s-promotion'},
        redirect: '/studentImport',
        children: [
            {
                path: '/studentImport',
                component: () => import('@/views/student/import'),
                name: 'StudentImport',
                meta: { title: '文件上传', noCache: true }
            },
            {
                path: '/studentList',
                component: () => import('@/views/student/list'),
                name: 'StudentList',
                meta: { title: '信息列表', noCache: true }
            },
            {
                path: '/studentExport',
                component: () => import('@/views/student/export'),
                name: 'StudentExport',
                meta: { title: '搜索下载', noCache: true }
            },
            {
                path: '/studentLog',
                component: () => import('@/views/student/logs'),
                name: 'StudentLog',
                meta: { title: '操作日志', noCache: true }
            }

        ]
    },
    {
        path: '/baseInfo',
        component: Layout,
        meta:{title:'基础管理', icon:'el-icon-menu'},
        name: 'BaseInfo',
        redirect: '/adminUserList',
        children: [
            /*{
                path: '/adminMenuList',
                component: () => import('@/views/adminMenu/list'),
                name: 'AdminMenuList',
                meta: { title: '菜单管理', noCache: true }
            },*/
            {
                path: '/adminUserList',
                component: () => import('@/views/adminUser/list'),
                name: 'AdminUser',
                meta: { title: '用户管理', noCache: true }
            },
            {
                path: '/adminUserDetail',
                component: () => import('@/views/adminUser/detail'),
                name: 'AdminUserDetail',
                meta: { title: '新增用户' , noCache: true },
                hidden: true
            }

            /*{
                path: '/adminRoleList',
                component: () => import('@/views/adminRole/list'),
                name: 'AdminRoleList',
                meta: { title: '角色管理', noCache: true }
            },
            {
                path: '/roleList/:id',
                component: () => import('@/views/adminRole/detail'),
                name: 'AdminRoleDetail',
                meta: { title: '角色管理' },
                hidden: true
            }*/
        ]
    },
]

export const userRouterMap = [
    {
        path: '/studentInfo',
        component: Layout,
        name: 'StudentInfo',
        meta: {title: '信息管理', icon: 'el-icon-s-promotion'},
        redirect: '/studentExport',
        children: [
            /*{
                path: '/studentImport',
                component: () => import('@/views/student/import'),
                name: 'StudentImport',
                meta: {title: '文件上传', noCache: true}
            },
            {
                path: '/studentList',
                component: () => import('@/views/student/list'),
                name: 'StudentList',
                meta: {title: '信息列表', noCache: true}
            },*/
            {
                path: '/studentExport',
                component: () => import('@/views/student/export'),
                name: 'StudentExport',
                meta: {title: '搜索下载', noCache: true}
            },
            {
                path: '/studentLog',
                component: () => import('@/views/student/logs'),
                name: 'StudentLog',
                meta: {title: '操作日志', noCache: true}
            }

        ]
    }
]

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  // base:__dirname,
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})